package com.huawei.gamebox.service.welfare.gift.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import com.huawei.gamebox.service.welfare.gift.bean.GameGiftCardBean;
import o.cgu;
import o.chz;
import o.cih;
import o.exp.j;
import o.fcc;

public class GameGiftCardNode extends BaseGiftNode {
    public GameGiftCardNode(Context context) {
        super(context);
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(cgu.ˋ(), -1);
        LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams2.weight = 1.0f;
        int ˏ = ˏ();
        for (int i = 0; i < ˏ; i++) {
            if (i != 0) {
                viewGroup.addView(new Space(this.ॱ), layoutParams);
            }
            View ˊ = ˊ(this.ˊ);
            if (ˊ != null) {
                cih o_fcc = new fcc(this.ॱ, false);
                o_fcc.ˏ(ˊ);
                ˊ(o_fcc);
                viewGroup.addView(ˊ, layoutParams2);
            }
        }
        return true;
    }

    public boolean ॱ(chz o_chz, ViewGroup viewGroup) {
        int ˏ = ˏ();
        this.ˏ = o_chz.ˏ;
        for (int i = 0; i < ˏ; i++) {
            cih ˎ = ˎ(i);
            if (ˎ instanceof fcc) {
                CardBean ˋ = o_chz.ˋ(i);
                if (ˋ instanceof GameGiftCardBean) {
                    ˋ.ˋˋ(String.valueOf(this.ˏ));
                    ˎ.ˎ((GameGiftCardBean) ˋ, viewGroup);
                    ˎ.ˉ().setVisibility(0);
                } else {
                    ˎ.ˉ().setVisibility(8);
                }
            }
        }
        return true;
    }

    protected View ˊ(LayoutInflater layoutInflater) {
        if (layoutInflater == null) {
            return null;
        }
        int i = j.ॱʽ;
        if (ˋ()) {
            i = j.ͺ;
        }
        RelativeLayout relativeLayout = (RelativeLayout) layoutInflater.inflate(i, null);
        if (relativeLayout == null) {
            return relativeLayout;
        }
        int ˎ = ˎ();
        relativeLayout.setPadding(ˎ, 0, ˎ, 0);
        return relativeLayout;
    }
}
